home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 8
/
Night Owl CD-ROM (NOPV8) (Night Owl Publisher) (1993).ISO
/
047a
/
probots.arj
/
LEADER.PR
< prev
next >
Wrap
Text File
|
1988-11-05
|
2KB
|
66 lines
PROCEDURE LEADER;
{ Based on a C-Robot by John Smolin }
{ Strategy: Lead the target so robot can kill foes that move fast. }
VAR
x, orange, ox, dir, Range, rlead : Integer;
BEGIN {Leader Main}
IF loc_x > 500
THEN drive(180, 100)
ELSE drive(0, 100);
x := 336;
rlead := 50;
REPEAT {Until Dead or Winner}
x := x+344;
Range := scan(x, 8);
WHILE (Range = 0) DO {find a target}
BEGIN
x := x+16;
Range := scan(x, 8);
END;
cannon(x, Range); {blast him!}
dir := x;
IF (Range > 200) THEN drive(x, 100); {follow him}
Range := scan(x, 8);
WHILE (Range > 0) DO
BEGIN
IF (Range > 200) THEN
BEGIN
ox := x;
orange := Range;
IF scan(x-4, 4) > 0 THEN x := x-4;
IF scan(x-2, 2) > 0 THEN x := x-2;
IF scan(x-1, 1) > 0 THEN x := x-1;
Range := scan(x, 10);
IF (Range > 0) THEN
cannon(x+(x-ox)*Range DIV 200, Range+(Range-orange+rlead)*Range DIV 275);
IF (speed < 51) OR (((x-dir)*(x-dir)) > 400) THEN
BEGIN
dir := x;
drive(x, 100);
rlead := 25;
END
ELSE rlead := 50;
END
ELSE
BEGIN
x := x+20;
WHILE (Range < 800) DO
BEGIN
x := x+340;
Range := scan(x, 10);
WHILE (Range = 0) DO {find him}
BEGIN
x := x+20;
Range := scan(x, 10);
END;
cannon(x, Range); {blast him!}
dir := x;
IF (speed < 50) OR (Range > 200) THEN drive(x, 100); {follow him}
END;
END;
END;
UNTIL Dead OR Winner;
END; {Leader Main}